<?php
namespace Task\Task;

// hook task_task_use.php

use Task\Controller;

class Index extends Controller
{
    // hook task_task_start.php

    //只处理一小时内的--延迟到账
    public function frozen_at()
    {


    }


    //访问量
    public function views($data)
    {

        $views = [];
        foreach ($this->_T('Views') as $k => $row) {
            $this->_T('Views')->set($k, ['Views' => 0]);
            $this->_T('Views')->del($k);
            $views[$k] = $row['views'];
        }

        foreach ($views as $k => $num) {
            [$m, $id] = explode('#', $k);
            switch ($m) {
                // hook task_task_views_switch_start.php
                case 'Notice':
                    //$this->Notice->update([$this->Notice->index => $id], ['views+' => $num]);
                    break;
                case 'Tags':
                    //$this->Tags->update([$this->Tags->index => $id], ['views+' => $num]);
                    break;
            }
        }
        return true;
    }


    // hook task_task_end.php
}
